/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MyClass;


import javax.microedition.lcdui.Image;

/**
 *
 * @author HuuTai_it
 */

public class BlackShip extends Ship {

    public int autoMove(Ship s)
    {
        return super.bAutoMove(s,5);                
    }
    public BlackShip (GameManagement gameMng, Image image) throws Exception {
        
        super(gameMng, image);
        
        boolean temp = true;
        while(temp) {
            
            int x = Math.abs(gameMng.r.nextInt() % 10);
            int y = Math.abs(gameMng.r.nextInt() % 10);
            int mX = gameMng.mainShip.getX() / 24;
            int mY = gameMng.mainShip.getY() / 24;
            
            if(gameMng.element[x][y] == 0 &&
               ((gameMng.control.level < 6 && (Math.abs(x - mX) > 3 || Math.abs(y - mY) > 3)) ||
               (gameMng.control.level > 5 && gameMng.control.level < 11 && (Math.abs(x - mX) > 2 || Math.abs(y - mY) > 2)) ||
               (gameMng.control.level > 10 && (Math.abs(x - mX) > 1 || Math.abs(y - mY) > 1)))) {                
                setPosition(x * 24, y * 24);
                gameMng.element[x][y] = 5;
                temp = false;
            }
        }
       sType = 2;
    }  
    public int fire(){
        return 0;
    }
}
